<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of imwrite2</title>
  <meta name="keywords" content="imwrite2">
  <meta name="description" content="Similar to imwrite, except follows a strict naming convention.">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html &copy; 2003 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../m2html.css">
</head>
<body>
<a name="_top"></a>
<!-- menu.html images -->
<h1>imwrite2
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>Similar to imwrite, except follows a strict naming convention.</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>function I = imwrite2( I, mulFlag, imagei, path,name, ext, nDigits, nSplits, spliti, varargin ) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre class="comment"> Similar to imwrite, except follows a strict naming convention.

 Wrapper for imwrite that writes file to the filename:
  fName = [path name int2str2(i,nDigits) '.' ext];
 Using imwrite:
  imwrite( I, fName, writePrms )
 If I represents a stack of images, the ith image is written to:
  fNamei = [path name int2str2(i+imagei-1,nDigits) '.' ext];
 If I=[], then imwrite2 will attempt to read images from disk instead.
 If dir spec. by 'path' does not exist, imwrite2 attempts to create it.

 mulFlag controls how I is interpreted.  If mulFlag==0, then I is
 intrepreted as a single image, otherwise I is interpreted as a stack of
 images, where I(:,:,...,j) represents the jth image (see fevalArrays for
 more info).

 If nSplits&gt;1, writes/reads images into/from multiple directories. This is
 useful since certain OS handle very large directories (of say &gt;20K
 images) rather poorly (I'm talking to you Bill).  Thus, can take 100K
 images, and write into 5 separate dirs, then read them back in.

 USAGE
   I = imwrite2( I, mulFlag, imagei, path, ...
     [name], [ext], [nDigits], [nSplits], [spliti], [varargin] )

 INPUTS
  I           - image or array or cell of images (if [] reads else writes)
  mulFlag     - set to 1 if I represents a stack of images
  imagei      - first image number
  path        - directory where images are
  name        - ['I'] base name of images
  ext         - ['png'] extension of image
  nDigits     - [5] number of digits for filename index
  nSplits     - [1] number of dirs to break data into
  spliti      - [0] first split (dir) number
  writePrms   - [varargin] parameters to imwrite

 OUTPUTS
  I           - image or images (read from disk if input I=[])

 EXAMPLE
  load images; I=images(:,:,1:10); clear IDXi IDXv t video videos images;
  imwrite2( I(:,:,1), 0, 0, 'rats/', 'rats', 'png', 5 );   % write 1
  imwrite2( I, 1, 0, 'rats/', 'rats', 'png', 5 );          % write 5
  I2 = imwrite2( [], 1, 0, 'rats/', 'rats', 'png', 5 );    % read 5
  I3 = fevalImages(@(x) x,{},'rats/','rats','png',0,4,5);  % read 5

 EXAMPLE - multiple splits
  load images; I=images(:,:,1:10); clear IDXi IDXv t video videos images;
  imwrite2( I, 1, 0, 'rats', 'rats', 'png', 5, 2, 0 );      % write 10
  I2=imwrite2( [], 1, 0, 'rats', 'rats', 'png', 5, 2, 0 );  % read 10

 See also FEVALIMAGES, FEVALARRAYS

 Piotr's Computer Vision Matlab Toolbox      Version 2.30
 Copyright 2014 Piotr Dollar.  [pdollar-at-gmail.com]
 Licensed under the Simplified BSD License [see external/bsd.txt]</pre></div>





<!-- Start of Google Analytics Code -->
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-4884268-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>
<!-- end of Google Analytics Code -->

<hr><address>Generated by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" target="_parent">m2html</a></strong> &copy; 2003</address>
</body>
</html>
